/*
 * @Date: 2020-08-24 09:14:18
 * @LastEditors: xujianxing
 * @LastEditTime: 2020-08-25 16:46:28
 * @FilePath: \nili\src\app.module.ts
 */
import {
  Module,
  MiddlewareConsumer,
  // RequestMethod,
  NestModule,
  RequestMethod,
} from '@nestjs/common';
import { APP_FILTER, APP_GUARD } from '@nestjs/core';

import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UserModule } from './modules/user/user.module';

import {
  LoggerMiddleware,
  LoggerFunc,
} from './common/middleware/Logger.middleware';
import { UserController } from './modules/user/user.contoller';

import { HttpExceptionFilter } from './common/filters/http-exception.filter';
import { AuthGuard } from './common/guard/auth.guard';

@Module({
  imports: [UserModule],
  controllers: [AppController],
  providers: [
    AppService,
    // {
    //   provide: APP_FILTER,
    //   useClass: HttpExceptionFilter,
    // } /** 以依赖注入的方式进行引用全局过滤器 */,
    // {
    //   provide: APP_GUARD,
    //   useClass: AuthGuard,
    // }, /** 以依赖注入的方式进行引用全局守卫 */
  ],
})
export class AppModule {
  /**
   * 消费中间件
   * @param consumer 消费者
   */
  // configure(consumer: MiddlewareConsumer) {
  //   consumer.apply(LoggerFunc, LoggerMiddleware).forRoutes(UserController);
  // }
}
